home *** CD-ROM | disk | FTP | other *** search
/ Apple Developer Connection Student Program / ADC Tools Sampler CD Disk 3 1999.iso / Documentation / Books / Learn Java on the Macintosh / Learn Java Projects / 09.04 - variable / ClassVar.java < prev    next >
Text File  |  1996-04-22  |  582b  |  25 lines

  1. /* -------------------------------------------------------------
  2. This applet shows a simple example of accessing a class variable.
  3.  
  4. Java's classes: Applet    (applet)
  5.                 System    (lang)
  6.  
  7. Custom classes: ClassVar
  8.  
  9. ------------------------------------------------------------- */
  10. public class ClassVar extends java.applet.Applet {
  11.  
  12.    static int test = 20;
  13.  
  14.    public void init() {
  15.       System.out.println("test = " + test);
  16.  
  17.       int test = 30;
  18.       
  19.       System.out.println("test = " + test);
  20.  
  21.       System.out.println("ClassVar.test = " + ClassVar.test);
  22.    }
  23.  
  24. }
  25.